<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title a m-cf"><{$tit}>列表</div>
                </div>
                <div class="am-tabs am-margin-bottom">
                    <{tabTit1($tabtit)}>
                </div>
                <div class="widget-body am-fr">
                    <{if $tips}>
                    <div class="tips am-margin-bottom-sm am-u-sm-12">
                        <div class="pre">
                            <p> 1：</p>
                        </div>
                    </div>
                    <{/if}>
                    <!-- 工具栏 -->
                    <div class="page_toolbar am-margin-bottom-xs am-cf">
                        <{include file=$module.'/public/toolbar.php'}>
                    </div>
                    <div class="am-scrollable-horizontal am-u-sm-12">
                        <form id="form-opid" method="post" action="">
                        <table width="100%" class="am-table am-table-compact am-table-striped
                            tpl-table-black am-text-nowrap">
                            <thead>
                            <tr>
                                <th>
                                    <label class="am-checkbox-inline">
                                        <input type="checkbox" id="checkedAllBtn" data-am-ucheck />
                                        ID
                                    </label>
                                </th>
                                <th>名称</th>
                                <th>拼音</th>
                                <th>分站</th>
                                <th>排序</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if (!empty($list)): foreach ($list as $item): ?>
                                <tr>
                                    <td class="am-text-middle">
                                        <label class="am-checkbox-inline">
                                            <input type="checkbox" name="opid[]" value="<?= $item['id'] ?>" data-am-ucheck />
                                            <?= $item['id'] ?>
                                        </label>
                                    </td>
                                    <td class="am-text-middle">
                                        <{if $item.level<3}>
                                        <a href="/<{$routeUrl}>/index?parent_id=<?= $item['id'] ?>&tab=<{$tab}>">
                                            <?= $item['name'] ?>
                                        </a>
                                        <{else}>
                                            <?= $item['name'] ?>
                                        <{/if}>
                                    </td>
                                    <td class="am-text-middle"><?= $item['pinyin'] ?></td>
                                    <td class="am-text-middle">
                                           <span class="j-state2 am-badge x-cur-p
                                           am-badge-<?= $item['is_site'] == 1 ? 'success' : 'warning' ?>"
                                                 data-id="<?= $item['id'] ?>"
                                                 data-state="<?= $item['is_site'] ?>">
                                               <?= $yesRadio[$item['is_site']] ?>
                                           </span>
                                    </td>
                                    <td class="am-text-middle"><?= $item['sort'] ?></td>
                                    <td class="am-text-middle">
                                        <{include file=$module.'/public/act.php'}>
                                    </td>
                                    <td class="am-text-middle">
                                        <{include file=$module.'/public/edit.php'}>
                                    </td>
                                </tr>
                            <?php endforeach; else: ?>
                                <tr>
                                    <td colspan="6" class="am-text-center">暂无记录</td>
                                </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                        </form>
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <{$showPage nofilter}>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        // 商品状态
        $('.j-state').click(function () {
            // 验证权限
            if (!"<?= checkPrivilege('goods/state')?>") {
                return false;
            }
            var data = $(this).data();
            layer.confirm('确定要' + (parseInt(data.state) === 0 ? '显示' : '隐藏') + '操作吗？'
                , {title: '友情提示'}
                , function (index) {
                    $.post("/<{$routeUrl}>/act"
                        , {
                            id: data.id,
                            status: Number(!(parseInt(data.state) === 1))
                        }
                        , function (result) {
                            result.code === 1 ? $.show_success(result.msg, result.url)
                                : $.show_error(result.msg);
                        });
                    layer.close(index);
                });
        });

        // 商品状态
        $('.j-state2').click(function () {
            // 验证权限
            if (!"<?= checkPrivilege('goods/state')?>") {
                return false;
            }
            var data = $(this).data();
            layer.confirm('确定要' + (parseInt(data.state) === 0 ? '显示' : '隐藏') + '操作吗？'
                , {title: '友情提示'}
                , function (index) {
                    $.post("/<{$routeUrl}>/site_act"
                        , {
                            id: data.id,
                            status: Number(!(parseInt(data.state) === 1))
                        }
                        , function (result) {
                            result.code === 1 ? $.show_success(result.msg, result.url)
                                : $.show_error(result.msg);
                        });
                    layer.close(index);
                });
        });



    });
</script>

